﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Reflection;
using HsTec.DigitalPlatform.Model.DTO;
using HsTec.DigitalPlatform.DataAccess;
using HsTec.DigitalPlatform.DataAccess.Search;

namespace HsTec.DigitalPlatform.WebSite.Controllers {
    public class PlayerItemsController : Controller {

        PlayerItemsInfoRepository pi = new PlayerItemsInfoRepository();
        //
        // GET: /PlayerItems/

        public ActionResult Index() {
            return View();
        }
        [AcceptVerbs(HttpVerbs.Post)]
        public JsonResult QueryInfo(string qtxt, string qslt) {
            return Json(pi.GetQueryInfo(qtxt, qslt, 1));
        }
        public void ExportInfo(string id) {
            string[] ary = id.Split(',');
            HttpContext context = System.Web.HttpContext.Current;
            context.Response.Clear();
            context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            context.Response.AppendHeader("Content-Disposition", "attachment;filename=export.xls");
            context.Response.Write(pi.GetQueryInfo(ary[0], ary[1], 2));
            context.Response.End();
        }
    }
}
